package com.acarter.scenemonitor.propertydescriptor.enums;
/**
 * <p>Title</p>
 * 
 * <p>Description: </p>
 *
 * <p>Copyright (c) 2007</p>
 *
 * @author Andrew Carter
 * @version 
 */


/**
 * Enumerates the permissible fog density functions.
 * 
 * @author Andrew Carter
 */
public enum E_FogDensityFunction {

	/**
     * The fog blending function defined as: (end - z) / (end - start).
     */
    DF_LINEAR("DF_LINEAR", 0),
    
    /**
     * The fog blending function defined as: e^-(density*z)
     */
    DF_EXP("DF_EXP", 1),
    
    /**
     * The fog blending function defined as: e^((-density*z)^2)
     */

    DF_EXPSQR("DF_EXPSQR", 2);

	/** String representation of the enum value */
	private String name;

	/** Integer value of the enum value */
	private int value;

	/**
	 * Private constructor.
	 * 
	 * @param value
	 *            String literal of the enum
	 */
	private E_FogDensityFunction(String name, int value) {

		this.name = name;
		this.value = value;
	}

	/**
	 * Returns the enum constant matching the name string.
	 * 
	 * @param name
	 *            string value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_FogDensityFunction getConstant(String name) {

		for (E_FogDensityFunction constant : E_FogDensityFunction.values()) {

			if (constant.toString().compareToIgnoreCase(name) == 0)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the enum constant matching the type value.
	 * 
	 * @param type
	 *            type value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_FogDensityFunction getConstant(int type) {

		for (E_FogDensityFunction constant : E_FogDensityFunction.values()) {

			if (constant.getType() == type)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the string value of the constant.
	 */
	public String toString() {

		return name;
	}

	/**
	 * Returns the integer value of the constant.
	 * @return 
	 */
	public int getType() {

		return value;
	}
}
